<SCRIPT type="text/javascript">
	function submitAuth(name , obj){
		loadURL("/${orgi}/manage/role/${roleid}/roleauth.html?name="+name+"&value="+$(obj).prop('checked'),"#tempdiv",
		function(data){});
	}
</SCRIPT>
<#include "/pages/manage/role/left.html"/>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<div class="rs_layout_center">
	<div class="rs_layout">
		<div class="rs_layout_center">
			<div class="tableScrollWrap">
				<div class="rightCon">
				<div style="height: 389px;" class="rightList">
					<div style="margin-top:0px;" class="listCon">
						<ul class="nav_tapWrap nav_tabwps_4">
							<li class="nav_tapIthems"><a href="/${orgi}/manage/role/list/${roleid}/${groupid!''}.html"><i class="tabIcon tabicon-2"></i>用户</a></li>
							<li class="nav_tapIthems cur"><a href="/${orgi}/manage/role/rolelevel/${roleid}/${groupid!''}.html"><i class="tabIcon tabicon-6"></i>权限</a></li>
						</ul>
					</div>
					<form method="post" action="/rivues/manage/account/organaddo.html" id="organaddForm" class="form-horizontal"> 
						<div class="nav_tabwps_4con">
							<div class="nav_tabwps_4_layouts show" style="padding:0;">								
								<table class="table_style_1">
									<thead>
										<tr>
											<th style="width:50px;">&nbsp;</th>
											<th style="width:240px;">权限名称</th>	 											
											<th>授权项</th>
											<th style="width:16px;">&nbsp;</th>
											<th style="width:50px;">&nbsp;</th>
											<#if ex??>
											<th class="minSize"></th>
											</#if>
											
										</tr>
									</thead>
									<#if datas ??>
										<#list datas as da>
											<tbody>
												<#if !da.groupid ?? || da.groupid =="">
												<tr>
													<#if ex ??>
														<td class="minSize" style="border-bottom:1px solid #cccccc;">
															<a href="#" onclick="controlDiv('${da.id}')">
																<i id="but${da.id}" class="tbControlIcon a_close" style="height:16px;width:16px"></i>
															</a>
														</td>
														<td colspan="6" style="border-bottom:1px solid #cccccc;"><h4>${da.title!""}</h4></td>
													<#else>
														<td class="minSize" style="border-bottom:1px solid #cccccc;">
															<a href="#" onclick="controlDiv('${da.id}')">
																<i id="but${da.id}" class="tbControlIcon a_close" style="height:16px;width:16px"></i>
															</a>
														</td>
														<td colspan="4" style="border-bottom:1px solid #cccccc;"><h4>${da.title!""}</h4></td>
													</#if>
												</tr>
												</#if>
											</tbody>
											<tbody id="${da.id}">
												<tr>
													<#if propertiesList??>
														<#list propertiesList as properties>
														<#assign templateSource = "${properties.groupid}"> 
														<#if da.name ?? && da.name = templateSource>
														<tr>
															<td class="minSize"><#if properties.levels?? && properties.levels=="1"><div style="font-weight:bold;color:red;font-size:18px;">*</div></#if></td>
															<td style="width:240px;">
																${properties.title!''}
															</td>
															<#if ex??>
															<td style="width:240px;">
																${properties.name!''}
															</td>
															</#if>
															<#if ex??>
																<td style="width:840px;"><#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if></td>
															<#else>
																<#if properties.paramtype ?? && (properties.paramtype == "5" || properties.paramtype == "6"|| properties.paramtype == "7"|| properties.paramtype == "8")>
																	<td style="width:840px;">
																		<#if properties.paramtype == "7" || properties.paramtype == "8">
																			<#assign hasPer = false>
																			<#if authList??>
																				<#list authList as auth>
																					<#if auth.dataid == properties.name>
																						<#assign hasPer = true>
																						<#break/>
																					</#if>
																				</#list>
																			</#if>
																			<SCRIPT type="text/javascript">
																				$(document).ready(function(){
																					var id =  "${properties.id}";
																					var paramtype = "${properties.paramtype}";
																					var paramvalue = "${properties.paramvalue}";
																					var value =<#if properties.value??> "${properties.value}"<#else>""</#if>;
																					var type = "radio";
																					if(paramtype == "8"){
																						type = "checkbox"
																					}
																					if(paramvalue != null || paramvalue != "" || paramvalue != undefined){
																						var pva =  paramvalue.split(",");
																						var con = "";
																						for(var i = 0 ; i < pva.length ; i ++){
																							var paramv = pva[i].split(":");
																							if(paramv.length>=2){
																								if(value == paramv[0]){
																									con += "<label><input id ="+i+" type="+type+" name = "+id+" value = "+paramv[0]+" <#if hasPer == true>checked = 'checked'</#if> onclick='submitAuth(\"${properties.name}\",this)'>"+paramv[1]+"</label>";
																								}else{
																									con += "<label><input id ="+i+" type="+type+" name = "+id+" value = "+paramv[0]+" <#if hasPer == true>checked = 'checked'</#if> onclick='submitAuth(\"${properties.name}\",this)'>"+paramv[1]+"</label>";
																								}
																							}else{
																								if(value == pva[i]){
																									con += "<label><input id ="+i+" type="+type+" name = "+id+" value = "+pva[i]+"  <#if hasPer == true>checked = 'checked'</#if>  onclick='submitAuth(\"${properties.name}\",this)'>"+pva[i]+"</label>";
																								}else{
																									con += "<label><input id ="+i+" type="+type+" name = "+id+" value = "+pva[i]+" <#if hasPer == true>checked = 'checked'</#if>  onclick='submitAuth(\"${properties.name}\",this)'>"+pva[i]+"</label>";
																								}
																							}
																						}
																					}
																					$("#radioorcheck"+id).html(con);
																				});
																			</SCRIPT>	
																			<div id ="radioorcheck${properties.id}"></div>
																		<#else>
																			<#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if>
																		</#if>
																	</td>
																<#else>
																	<td style="width:840px;" ondblclick="dblclick('${properties.id!""}','${properties.paramtype!""}','${properties.paramvalue!""}','${properties.value!""}')">
																		<div id = "div_${properties.id}" >
																			<#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if>
																		</div>
																	</td>
																</#if>
															</#if>
															<td style="width:50px;">
																<a href="/${orgi}/manage/task/searchsettingadd/${properties.name!''}/${type}.html" data-toggle="ajax" title="预警">
																	<#if properties.earlywarning ?? &&  properties.earlywarning == "1">
																		<i class="tbControlIcon top_icon122"></i>
																	</#if>
																</a>
															</td>
															<td style="width:350px;" title="${properties.description!''}">
																<#if properties.earlywarning ?? &&  properties.earlywarning == "1" && properties.description??>
																	<#if properties.description?length gt 20>${properties.description[0..20]}<#else>${properties.description!''}</#if>
																</#if>
															</td>							
														</tr>
														</#if>
														</#list>
													</#if>
												</tr>
												<#if configdatas ??>
												<#list configdatas as con>
												<#assign template = "${con.groupid}"> 
												<#if da.name ?? && da.name = template>
												<tr>
													<#if ex ??>
														<td class="minSize"></td>
														<td colspan="6" style="border-bottom:1px solid #cccccc;"><h4>${con.title!""}</h4></td>
													<#else>
														<td class="minSize"></td>
														<td colspan="4" style="border-bottom:1px solid #cccccc;"><h4>${con.title!""}</h4></td>
													</#if>
												</tr>
												</#if>
												</#list>
												</#if>
											</tbody>
										</#list>
									<#else>
										<tbody>
											<#if propertiesList??>
												<#list propertiesList as properties>
												<tr>
													<td class="minSize"><#if properties.levels?? && properties.levels=="1"><div style="font-weight:bold;color:red;font-size:18px;">*</div></#if></td>
													<td style="width:240px;">
														${properties.title!''}
													</td>
													<#if ex??>
													<td style="width:240px;">
														${properties.name!''}
													</td>
													</#if>
													
													<#if ex??>
														<td style="width:840px;"><#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if></td>
													<#else>
														<#if properties.paramtype ?? && (properties.paramtype == "5" || properties.paramtype == "6"|| properties.paramtype == "7"|| properties.paramtype == "8")>
															<td style="width:840px;">
															<#if properties.paramtype == "7" || properties.paramtype == "8">   																
																<div id ="radioorcheck${properties.id}"></div>
															<#else>
																<#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if>
															</#if>
															</td>
														<#else>
															<td style="width:840px;" ondblclick="dblclick('${properties.id!""}','${properties.paramtype!""}','${properties.paramvalue!""}','${properties.value!""}')">
																<div id = "div_${properties.id}" >
																	<#if properties.value?? && properties.value?length gt 50>${properties.value[0..50]}<#else>${properties.value!''}</#if>
																</div>
															</td>
														</#if>
													</#if>
													<td style="width:50px;">
														<a href="/${orgi}/manage/task/searchsettingadd/${properties.name!''}/${type}.html" data-toggle="ajax" title="预警">
															<#if properties.earlywarning ?? &&  properties.earlywarning == "1">
																<i class="tbControlIcon top_icon122"></i>
															</#if>
														</a>
													</td>
													<td style="width:350px;" title="${properties.description!''}">
														<#if properties.earlywarning ?? &&  properties.earlywarning == "1" && properties.description??>
															<#if properties.description?length gt 20>${properties.description[0..20]}<#else>${properties.description!''}</#if>
														</#if>
													</td>							
												</tr>
												</#list>
											</#if>
										</tbody>
									</#if>
								</table>
							</div>
						
					</div></form>
				</div>
			</div>
			</div>
			
			
		</div>
		<div class="rs_layout_bottom toolBar_bottom">
			<ul class="toolbarBottom_IconWrap">
				<li class="tb-icons-1"></li>
				<li class="tb-icons-2"></li>
				<li class="tb-icons-3"></li>
				<li class="tb-icons-4"></li>
			</ul>
		</div>
	</div>
</div>